package com.yxc.validationdemo.controller;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.omg.CORBA.Object;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 * @author: YXC
 * @time: 2023/2/8 15:14
 **/
@Slf4j
@RestController
@RequestMapping("/run")
public class RunController {

    @Validated
    @PostMapping("/notNull")
    public Map<String, Object> testNotNull(
            @RequestBody @NotNull(message = "not null") JSONObject params
    ) {
        log.info("notNull接口收到数据: {}", params.toJSONString());
        return null;
    }

}
